#pragma once

#include "CalcThreadHolder.h"
#include "Approach.h"

struct NewCalcParam
{
	enum eAction
	{
		eInit,
		eCalc,
		eResize,
	};

	NewCalcParam(): action(eInit), dFrom(0.0), dTo(0.0), dBegin(0.0), dEnd(0.0) {};

	double dFrom;
	double dTo;
	double dBegin;
	double dEnd;
	eAction	action;
};

class CTrajectoryBuilder
{
public:
	CTrajectoryBuilder(OnErrorNotifyInterface *pNotyInterface);
	~CTrajectoryBuilder(void);

	bool Open(LPCTSTR sztFileName = NULL);
	bool Prepare();
	bool Calc(IApproachHolder *pAppHolderInterface, NewCalcParam * param);
	bool IsWork() const;
	bool GetTimeRange(double &dStart, double &dTo);
	bool GetRefRange(CGridParam * param);

	bool OnError(LPCTSTR stzError);
protected:
	OnErrorNotifyInterface	*m_pNotyInterface;

	CCalcThreadHolderAP m_pCalcThreadHolder;

	double		m_dRefRangeKm;
	double		m_dStartTime;
	double		m_dEndTime;
	SBody		m_bodyRefPos;
};
